/**
 * FileName: Loffer06
 * Author:   powersi
 * Date:     2021/3/3 23:53
 * Description:
 */
package com.zm.demo.core.leetcode;

/**
 * Description: 
 * Author:      powersi
 * Date:        2021/3/3 23:53
 */
public class Loffer06 {

    public int[] reversePrint(ListNode head) {
        int count = 0;
        ListNode node = head;
        while (node!=null){
            count++;
            node = node.next;
        }

        int []r = new int[count];
        while (head != null){
            r[count--] = head.val;
            head = head.next;
        }

        return r;
    }
}
